--[[/**
-- * 
 * 放技能
-- *
-- */]]

---@class BuffEffect373101 : BaseBuffEffect
BuffEffect373101 = ClientFight.CreateClass("BuffEffect373101", ClientFight.BaseBuffEffect)
local t = BuffEffect373101

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local skillId = buff.buffBean.f_BuffEffectValue[2];
    local dis = Utils.toRatio(buff.buffBean.f_BuffEffectValue[1]);
    local team = fight.teams[3 - buff.target.teamIndex];
    local target = nil;
    for k, enemy in pairs(team.fighters) do
        local fdis = DistanceUtil.countDistance(buff.target.position, enemy.position);
        local flagBuff = BuffManager.getBuffByModel(enemy, buff.buffBean.f_BuffEffectValue[3]);
        if (enemy:isDie()) then
            goto continue;
        end
        if (fdis > dis) then
            goto continue;
        end
        if (flagBuff ~= nil) then
            goto continue;
        end
        target = enemy;
        ::continue::
        break ;
    end
    if (target == nil) then
        return IBuffEffect.FAIL;
    end
    ClientFight.BaseBuffEffect.triggerSkill(self, fight, buff.target, target, skillId);
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff"
            .. buff.modelId .. " 触发释放技能：" .. skillId);
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()